<template>
  <div class="dialog dialog-22 dialog-dom">
    <div ref="dialog4" class="dialogs" @click.native="moveNext">
      <template v-for="(item, index) in dialogs.dialog22">
        <div v-if="dialogCurrent === index" :key="index" class="animated fadeIn" :class="item.class + ' dialog' + (index + 1)">
          <span>{{item.content}}</span>
        </div>
      </template>
    </div>
  </div>
</template>

<script>
import dialogs from '../dialogs'

export default {
  name: 'HelloWorld',
  props: ['dialogCurrent'],
  data () {
    return {
      dialogs,
    }
  },
  watch: {
    dialogCurrent (val) {
      console.log('dialogCurrentWatch', val, dialogs.dialog22.length )
      if (val > dialogs.dialog22.length - 1) {
        this.$emit('move-next')
      }
    }
  },
  methods: {
    moveNext(e) {
      e.preventDefault()
      console.log('moveNext')
      this.$emit('move-next')
    }
  }
}
</script>

<style lang="less" scoped>
.dialog-22 {
  .dialog1 {
    top: 2.4rem;
    left: 1.6rem;
    width: 0.8rem;
  }
  .dialog2 {
    width: 1.7rem;
    top: 3.38rem;
    left: 0.17rem;
  }
  .dialog3 {
    top: 2.27rem;
    left: 1.6rem;
    width: 0.9rem;
  }
  .dialog4 {
    width: 1.7rem;
    top: 3.38rem;
    left: 0.17rem;
  }
}
</style>

